botlandfandomcom-20200215-history
APIs
=Built-In= update() - Every script must contain a top-level update function. This function will be called each time your bot gets a turn. init() - An optional function that can be defined at the top-level and will run once at the beginning of each phase. General canSense(entity) - Returns if the bot can sense the passed entity. exists(any) - Checks that the passed variable exists and is defined. filterEntities(entities, filter1filter2) - Filters an array of entities by either distance or life. findClosestEnemyBot() - Returns the enemy bot with the lowest distance. findEntities(owner, type, allowReturningSelf) - Returns all entities fitting the specified criteria. findEntitiesInRange(owner, type, allowReturningSelf, range) - Returns all entities fitting the specified criteria. findEntity(owner, type, filter1filter2) - Returns the entity fitting the specified criteria. getDistanceTo(x, y) or getDistanceTo(entity) - Returns the manhattan to a tile or an entity that the bot can sense. getEntityAt(x, y) - Returns the entity at the specified tile if the bot can sense it. getLife(entity) - Returns the life of the entity at the specified tile if the bot can sense it. getX(entity) - Returns the x coordinate of the entity at the specified tile if the bot can sense it. getY(entity) - Returns the y coordinate of the entity at the specified tile if the bot can sense it. reduceEntities(entities, REDUCE_BY_MISSING_LIFE) - Returns the total missing health of a group of entities. Movement canMove(direction) - Returns whether the bot can move in the specified or any direction. canMoveTo(x, y) or canMoveTo(entity) - Returns whether the bot can sense a path to the specified location or entity. move(direction) - Attempts to move the bot in a specified or random direction. moveTo(x, y) or moveTo(entity) - Attempts to move the bot to a specified tile or entity. pursue() - alias of moveTo(). Sensors activateSensors() - Attempts to activate the bot's sensors. areSensorsActivated() - Checks if the bot currently has its sensors activated. canActivateSensors() - Checks if the bot can activate its sensors. Utility / Math abs(number) - Returns the absolute value of number. percentChance(number) - Returns true number% of the time. randInt(inclusiveMin, exclusiveMax) - Returns a number between inclusiveMin and exclusiveMax clampNumber(number, lower, upper) - Returns the value closest to the number that is restricted between the lower and upper bounds size(array or string) - Returns the number of entries of an array or the number of characters in a string. floor(number) - Returns the largest integer less than or equal to the number. ceil(number) - Returns the smallest integer greater than ot equal to the number. round(number) - Returns the value of the number rounded to the nearest integer. min(value1value2[, ...]) - Returns the smallest of multiple values. max(value1value2[, ...]) - Returns the largest of multiple values. =Weapon Hardware= Melee canCharge() - Returns true if the bot's Melee charge cooldown is ready. melee(entity) - Attempts to melee an enemy or the passed entity. willMeleeHit(entity) - Returns true if there is an enemy within melee range or if the passed entity is within melee range. Missiles fireMissiles(entity) - Attempts to fire missiles at a target within range or at the specified entity. willMissilesHit(entity) - Returns true if the specified entity is within range of the equipped missiles. Lasers willLasersHit(entity) - Returns true if the specified target is within range of the equipped lasers. fireLasers(or direction) - Attempts to fire the equipped lasers at the specified entity or fires in the specified direction. Artillery willArtilleryHit(entity) - Returns true if the specified entity is within range of the equipped artillery. fireArtillery(entity) - Attempts to fire the equipped artillery at the specified entity. Zapper canZap() - Returns true if the equipped Zapper's cooldown is ready isZapping() - Returns true if the bot currently has Zapper activated. zap() - Attempts to activate the equipped Zapper. Landmines canLayMine() - Returns true if there is not a Mine already placed in the occupied tile. layMine() - Attempts to place a Mine in the occupied tile. =Support Hardware= Shield canShield(entity) - Returns true if the equipped Shield hardware's cooldown is ready and the specified entity is within range. shield(entity) - Attempts to use the equipped Shield hardware on the specified entity. isShielded(entity) - Returns true if the specified entity is currently shielded. Reflect canReflect() - Returns true if the equipped Reflect hardware's cooldown is ready. isReflecting() - Returns true if the bot currently has Reflect active. reflect() - Attempts to activate the equipped Reflect hardware. Repair willRepair(entity) - Returns true if the bot is within range of the specified entity and the specified entity is damaged. repair(entity) - Attempts to use the equipped Repair hardware on the specified entity. EMP canEMP() - Returns true if the equipped EMP hardware's cooldown is ready. emp(equipmentType) - Attempts to use the equipped EMP hardware to disable the specified equipment type. Teleport canTeleport(y) or canTeleport(entity) - Returns true if the equipped Teleport's cooldown is ready and the bot can both sense the specified entity or tile and the destination is within range. teleport(x, y) or teleport(entity) - Attempts to teleport to the specified tile or adjacent to the specified entity within range. Category:Bot Land API